package com.offcn.contorller;


import com.offcn.pojo.Ren;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List;

@RestController
@Slf4j
public class RenContorller {
    public static final String PAYMENT_URL = "http://localhost:8080";
    @Resource
    private RestTemplate restTemplate;
    @GetMapping ("/ren/selectall")
    public List<Ren> all(){
        return restTemplate.getForObject(PAYMENT_URL+"/ren/selectall",List.class);
    }
    @GetMapping("/ren/selectid/{id}")
    public Ren getPayment(@PathVariable("id") int id){
        return restTemplate.getForObject(PAYMENT_URL+"/ren/selectid/"+id,Ren.class);
    }
}
